package agents.manager;

import agents.utils.Order;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.Iterator;
import java.util.LinkedList;
import javax.swing.DefaultListModel;
import javax.swing.ListModel;
import javax.swing.text.DefaultCaret;
import org.joda.time.DateTime;

/**
 * This class represents the ManagerAgent's Graphic User Interface.
 * @author Group 6
 */
public class ManagerAgentGUI extends javax.swing.JFrame {

    private ManagerAgent managerAgent;
    private String cuttingMachines;
    private String sewingMachines;
    private String packingMachines;
    private String pendingCuttingWP;
    private String pendingSewingWP;
    private String pendingPackingWP;
    private String assignedCuttingWP;
    private String assignedSewingWP;
    private String assignedPackingWP;
    private LinkedList<Order> actualOrders;
    
    public ManagerAgentGUI(ManagerAgent managerAgent) {
        initComponents();
        // Guarda referência para a class ManagerAgent
        this.managerAgent = managerAgent;
        // Define título da JFrame
        this.setTitle("Manager");
        // Define funcionamento dos variados logs
        DefaultCaret caret_1 = (DefaultCaret) this.jTextArea1_orderRequestsLog.getCaret();
        caret_1.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
        DefaultCaret caret_2 = (DefaultCaret) this.jTextArea2_wpDistributionLog.getCaret();
        caret_2.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
        DefaultCaret caret_3 = (DefaultCaret) this.jTextArea3_wpReceptionLog.getCaret();
        caret_3.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
        DefaultCaret caret_4 = (DefaultCaret) this.jTextArea4_orderDeliveryCancelLog.getCaret();
        caret_4.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
        // Inicializar dados
        this.cuttingMachines = "0";
        this.sewingMachines = "0";
        this.packingMachines = "0";
        this.pendingCuttingWP = "0";
        this.pendingSewingWP = "0";
        this.pendingPackingWP = "0";
        this.assignedCuttingWP = "0";
        this.assignedSewingWP = "0";
        this.assignedPackingWP = "0";
        this.actualOrders = new LinkedList<>();
        // Apresenta a JFrame
        this.showGui();
    }
    
    private void showGui() {
        pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        int centerX = (int) screenSize.getWidth() / 2;
        int centerY = (int) screenSize.getHeight() / 2;
        setLocation(centerX - getWidth() / 2, centerY - getHeight() / 2);
        super.setVisible(true);
    }

    public void setCuttingMachines(String cuttingMachines) {
        this.cuttingMachines = cuttingMachines;
    }

    public void setSewingMachines(String sewingMachines) {
        this.sewingMachines = sewingMachines;
    }

    public void setPackingMachines(String packingMachines) {
        this.packingMachines = packingMachines;
    }

    public void setPendingCuttingWP(String pendingCuttingWP) {
        this.pendingCuttingWP = pendingCuttingWP;
    }

    public void setPendingSewingWP(String pendingSewingWP) {
        this.pendingSewingWP = pendingSewingWP;
    }

    public void setPendingPackingWP(String pendingPackingWP) {
        this.pendingPackingWP = pendingPackingWP;
    }

    public void setAssignedCuttingWP(String assignedCuttingWP) {
        this.assignedCuttingWP = assignedCuttingWP;
    }

    public void setAssignedSewingWP(String assignedSewingWP) {
        this.assignedSewingWP = assignedSewingWP;
    }

    public void setAssignedPackingWP(String assignedPackingWP) {
        this.assignedPackingWP = assignedPackingWP;
    }

    public void setActualOrders(LinkedList<Order> actualOrders) {
        this.actualOrders = actualOrders;
    }
    
    public void appendInfoToManagerOrderRequestLog(String newInfo) {
        DateTime now = new DateTime();
        String time = Integer.toString(now.getYear())
                + "/"
                + Integer.toString(now.getMonthOfYear())
                + "/"
                + Integer.toString(now.getDayOfMonth())
                + " - "
                + Integer.toString(now.getHourOfDay())
                + ":"
                + Integer.toString(now.getMinuteOfHour())
                + ":"
                + Integer.toString(now.getSecondOfMinute());
        String text = time + "\n\t" +  newInfo + "\n";
        this.jTextArea1_orderRequestsLog.append(text);
    }
    
    public void appendInfoToManagerWPDistributionLog(String newInfo) {
        DateTime now = new DateTime();
        String time = Integer.toString(now.getYear())
                + "/"
                + Integer.toString(now.getMonthOfYear())
                + "/"
                + Integer.toString(now.getDayOfMonth())
                + " - "
                + Integer.toString(now.getHourOfDay())
                + ":"
                + Integer.toString(now.getMinuteOfHour())
                + ":"
                + Integer.toString(now.getSecondOfMinute());
        String text = time + "\n\t" +  newInfo + "\n";
        this.jTextArea2_wpDistributionLog.append(text);
    }
    
    public void appendInfoToManagerWPReceptionLog(String newInfo) {
        DateTime now = new DateTime();
        String time = Integer.toString(now.getYear())
                + "/"
                + Integer.toString(now.getMonthOfYear())
                + "/"
                + Integer.toString(now.getDayOfMonth())
                + " - "
                + Integer.toString(now.getHourOfDay())
                + ":"
                + Integer.toString(now.getMinuteOfHour())
                + ":"
                + Integer.toString(now.getSecondOfMinute());
        String text = time + "\n\t" +  newInfo + "\n";
        this.jTextArea3_wpReceptionLog.append(text);
    }
    
    public void appendInfoToManagerOrderDeliveryCancellationLog(String newInfo) {
        DateTime now = new DateTime();
        String time = Integer.toString(now.getYear())
                + "/"
                + Integer.toString(now.getMonthOfYear())
                + "/"
                + Integer.toString(now.getDayOfMonth())
                + " - "
                + Integer.toString(now.getHourOfDay())
                + ":"
                + Integer.toString(now.getMinuteOfHour())
                + ":"
                + Integer.toString(now.getSecondOfMinute());
        String text = time + "\n\t" +  newInfo + "\n";
        this.jTextArea4_orderDeliveryCancelLog.append(text);
    }
    
    public void updateAllInfo() {
        this.jLabel4_cuttingMachines.setText(this.cuttingMachines);
        this.jLabel5_sewingMachines.setText(this.sewingMachines);
        this.jLabel6_packingMachines.setText(this.packingMachines);
        this.jLabel12_pendingCuttingWP.setText(this.pendingCuttingWP);
        this.jLabel13_pendingSewingWP.setText(this.pendingSewingWP);
        this.jLabel14_pendingPackingWP.setText(this.pendingPackingWP);
        this.jLabel15_assignedCuttingWP.setText(this.assignedCuttingWP);
        this.jLabel16_assignedSewingWP.setText(this.assignedSewingWP);
        this.jLabel17_assignedPackingWP.setText(this.assignedPackingWP);
        // Orders List
        DefaultListModel<Order> listModel = new DefaultListModel<>();
        this.jList1_actualOrders.setModel(listModel);
        Iterator<Order> it = this.actualOrders.iterator();
        while (it.hasNext()) {
            listModel.addElement(it.next());
        }
        this.jList1_actualOrders.setModel(listModel);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4_cuttingMachines = new javax.swing.JLabel();
        jLabel5_sewingMachines = new javax.swing.JLabel();
        jLabel6_packingMachines = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel12_pendingCuttingWP = new javax.swing.JLabel();
        jLabel13_pendingSewingWP = new javax.swing.JLabel();
        jLabel14_pendingPackingWP = new javax.swing.JLabel();
        jLabel15_assignedCuttingWP = new javax.swing.JLabel();
        jLabel16_assignedSewingWP = new javax.swing.JLabel();
        jLabel17_assignedPackingWP = new javax.swing.JLabel();
        jSeparator3 = new javax.swing.JSeparator();
        jLabel18 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1_actualOrders = new javax.swing.JList();
        jLabel19 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea1_orderRequestsLog = new javax.swing.JTextArea();
        jLabel20 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextArea2_wpDistributionLog = new javax.swing.JTextArea();
        jLabel21 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTextArea3_wpReceptionLog = new javax.swing.JTextArea();
        jLabel22 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTextArea4_orderDeliveryCancelLog = new javax.swing.JTextArea();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel1.setText("Cutting Machines:");

        jLabel2.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel2.setText("Sewing Machines:");

        jLabel3.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel3.setText("Packing Machines:");

        jLabel4_cuttingMachines.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel4_cuttingMachines.setText("0");

        jLabel5_sewingMachines.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel5_sewingMachines.setText("0");

        jLabel6_packingMachines.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6_packingMachines.setText("0");

        jLabel7.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel7.setText("Pending WP");

        jLabel8.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel8.setText("Assigned WP");

        jLabel9.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel9.setText("Cutting:");

        jLabel10.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel10.setText("Sewing:");

        jLabel11.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel11.setText("Packing:");

        jLabel12_pendingCuttingWP.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel12_pendingCuttingWP.setText("0");

        jLabel13_pendingSewingWP.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel13_pendingSewingWP.setText("0");

        jLabel14_pendingPackingWP.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel14_pendingPackingWP.setText("0");

        jLabel15_assignedCuttingWP.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel15_assignedCuttingWP.setText("0");

        jLabel16_assignedSewingWP.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel16_assignedSewingWP.setText("0");

        jLabel17_assignedPackingWP.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel17_assignedPackingWP.setText("0");

        jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);

        jLabel18.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel18.setText("OrdersList:");

        jScrollPane1.setViewportView(jList1_actualOrders);

        jLabel19.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel19.setText("Order Requests Log:");

        jTextArea1_orderRequestsLog.setColumns(20);
        jTextArea1_orderRequestsLog.setRows(5);
        jScrollPane2.setViewportView(jTextArea1_orderRequestsLog);

        jLabel20.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel20.setText("WP Distribution Log:");

        jTextArea2_wpDistributionLog.setColumns(20);
        jTextArea2_wpDistributionLog.setRows(5);
        jScrollPane3.setViewportView(jTextArea2_wpDistributionLog);

        jLabel21.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel21.setText("WP Reception Log:");

        jTextArea3_wpReceptionLog.setColumns(20);
        jTextArea3_wpReceptionLog.setRows(5);
        jScrollPane4.setViewportView(jTextArea3_wpReceptionLog);

        jLabel22.setFont(new java.awt.Font("Lucida Grande", 1, 13)); // NOI18N
        jLabel22.setText("Order Delivery / Cancellation Log:");

        jTextArea4_orderDeliveryCancelLog.setColumns(20);
        jTextArea4_orderDeliveryCancelLog.setRows(5);
        jScrollPane5.setViewportView(jTextArea4_orderDeliveryCancelLog);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel9)
                                    .add(jLabel10)
                                    .add(jLabel11))
                                .add(27, 27, 27)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(jLabel7, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .add(jLabel12_pendingCuttingWP, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .add(jLabel13_pendingSewingWP, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .add(jLabel14_pendingPackingWP, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel15_assignedCuttingWP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 87, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(jLabel8)
                                    .add(jLabel16_assignedSewingWP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 87, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(jLabel17_assignedPackingWP, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 87, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                            .add(org.jdesktop.layout.GroupLayout.LEADING, jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, jSeparator2))
                        .add(layout.createSequentialGroup()
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jLabel2)
                                .add(jLabel3)
                                .add(jLabel1))
                            .add(36, 36, 36)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                .add(jLabel5_sewingMachines, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .add(jLabel6_packingMachines, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .add(jLabel4_cuttingMachines, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 274, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jLabel18))
                .add(8, 8, 8)
                .add(jSeparator3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel19)
                            .add(jLabel20)
                            .add(jLabel21)
                            .add(jLabel22))
                        .add(0, 0, Short.MAX_VALUE))
                    .add(layout.createSequentialGroup()
                        .add(6, 6, 6)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
                            .add(jScrollPane3)
                            .add(jScrollPane4)
                            .add(jScrollPane5))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(jLabel19)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel20)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel21)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel22)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(0, 0, Short.MAX_VALUE))
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE, false)
                            .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(jLabel4_cuttingMachines, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel2)
                            .add(jLabel5_sewingMachines))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel3)
                            .add(jLabel6_packingMachines))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel7)
                            .add(jLabel8))
                        .add(5, 5, 5)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel9)
                            .add(jLabel12_pendingCuttingWP)
                            .add(jLabel15_assignedCuttingWP))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel10)
                            .add(jLabel13_pendingSewingWP)
                            .add(jLabel16_assignedSewingWP))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel11)
                            .add(jLabel14_pendingPackingWP)
                            .add(jLabel17_assignedPackingWP))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel18)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane1))
                    .add(jSeparator3))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        this.managerAgent.shutdownAgentAndGUI();
    }//GEN-LAST:event_formWindowClosing

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12_pendingCuttingWP;
    private javax.swing.JLabel jLabel13_pendingSewingWP;
    private javax.swing.JLabel jLabel14_pendingPackingWP;
    private javax.swing.JLabel jLabel15_assignedCuttingWP;
    private javax.swing.JLabel jLabel16_assignedSewingWP;
    private javax.swing.JLabel jLabel17_assignedPackingWP;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4_cuttingMachines;
    private javax.swing.JLabel jLabel5_sewingMachines;
    private javax.swing.JLabel jLabel6_packingMachines;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JList jList1_actualOrders;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JTextArea jTextArea1_orderRequestsLog;
    private javax.swing.JTextArea jTextArea2_wpDistributionLog;
    private javax.swing.JTextArea jTextArea3_wpReceptionLog;
    private javax.swing.JTextArea jTextArea4_orderDeliveryCancelLog;
    // End of variables declaration//GEN-END:variables
}
